\hypertarget{communication_8h}{
\section{/home/noxon/coding/C/esiee-in301/libcomm/communication.h File Reference}
\label{communication_8h}\index{/home/noxon/coding/C/esiee-in301/libcomm/communication.h@{/home/noxon/coding/C/esiee-in301/libcomm/communication.h}}
}
{\tt \#include \char`\"{}../src/casual\_\-includes.h\char`\"{}}\par
{\tt \#include $<$unistd.h$>$}\par
{\tt \#include $<$sys/types.h$>$}\par
{\tt \#include $<$netinet/in.h$>$}\par
{\tt \#include $<$arpa/inet.h$>$}\par
{\tt \#include $<$sys/socket.h$>$}\par
{\tt \#include $<$sys/wait.h$>$}\par
{\tt \#include $<$netdb.h$>$}\par
{\tt \#include \char`\"{}message.h\char`\"{}}\par
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{structserver__struct}{server\_\-struct}
\item 
struct \hyperlink{structmodule__struct}{module\_\-struct}
\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{communication_8h_722965678f7ebad779fcd63c60ef79ab}{MAXRECVDATA}~1024
\item 
\#define \hyperlink{communication_8h_978ce57a33cae2acd7f85e16dc9b8d2f}{PORT\_\-INTERBOURSIER}~1200
\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef struct \hyperlink{structserver__struct}{server\_\-struct} \hyperlink{communication_8h_28331476d3a09aff9ad6d65418b6d896}{server}
\item 
typedef struct \hyperlink{structmodule__struct}{module\_\-struct} \hyperlink{communication_8h_62337a72340f3dbd62bda9ca1545767e}{module}
\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{communication_8h_0bc6723d5d4776ab7cdc646728b775f7}{TYPE} \{ \hyperlink{communication_8h_0bc6723d5d4776ab7cdc646728b775f7cee8aa0fdd5c1ef3adb3c501fd914bbf}{ack}, 
\hyperlink{communication_8h_0bc6723d5d4776ab7cdc646728b775f74d680ac6b2206c082fa95141c46ec197}{exec}, 
\hyperlink{communication_8h_0bc6723d5d4776ab7cdc646728b775f71338e5a4af684e9170f81e7be5a2732b}{term}, 
\hyperlink{communication_8h_0bc6723d5d4776ab7cdc646728b775f7d5ed0b0d8d34197735016386859a6ddf}{interb}
 \}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hyperlink{structmodule__struct}{module} $\ast$ \hyperlink{communication_8h_63a260a1d03237fc4f53b96f3b8586b1}{init\_\-module} (char $\ast$nom, int type, int bourse)
\item 
void \hyperlink{communication_8h_49502824c96a73bc576b4cf9e89dfad8}{log\_\-srv} (const \hyperlink{structserver__struct}{server} $\ast$srv, char $\ast$un\_\-msg)
\item 
void \hyperlink{communication_8h_21b24c0798c5ecdfd4cb777e5438a388}{log\_\-msg\_\-srv} (const \hyperlink{structserver__struct}{server} $\ast$srv, \hyperlink{structmsg__struct}{msg} $\ast$damsg, char $\ast$un\_\-msg)
\end{CompactItemize}


\subsection{Define Documentation}
\hypertarget{communication_8h_722965678f7ebad779fcd63c60ef79ab}{
\index{communication.h@{communication.h}!MAXRECVDATA@{MAXRECVDATA}}
\index{MAXRECVDATA@{MAXRECVDATA}!communication.h@{communication.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define MAXRECVDATA~1024}}
\label{communication_8h_722965678f7ebad779fcd63c60ef79ab}


\begin{Desc}
\item[Author:]: Christopher Rabotin Conçu pour gérer toutes les communications au sein du programme. \end{Desc}


Definition at line 19 of file communication.h.

Referenced by launch\_\-acquisition(), launch\_\-execution(), launch\_\-interboursier(), and launch\_\-terminal().\hypertarget{communication_8h_978ce57a33cae2acd7f85e16dc9b8d2f}{
\index{communication.h@{communication.h}!PORT\_\-INTERBOURSIER@{PORT\_\-INTERBOURSIER}}
\index{PORT\_\-INTERBOURSIER@{PORT\_\-INTERBOURSIER}!communication.h@{communication.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define PORT\_\-INTERBOURSIER~1200}}
\label{communication_8h_978ce57a33cae2acd7f85e16dc9b8d2f}




Definition at line 20 of file communication.h.

Referenced by launch\_\-acquisition(), launch\_\-interboursier(), and main().

\subsection{Typedef Documentation}
\hypertarget{communication_8h_62337a72340f3dbd62bda9ca1545767e}{
\index{communication.h@{communication.h}!module@{module}}
\index{module@{module}!communication.h@{communication.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf module\_\-struct}  {\bf module}}}
\label{communication_8h_62337a72340f3dbd62bda9ca1545767e}


\hypertarget{communication_8h_28331476d3a09aff9ad6d65418b6d896}{
\index{communication.h@{communication.h}!server@{server}}
\index{server@{server}!communication.h@{communication.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf server\_\-struct}  {\bf server}}}
\label{communication_8h_28331476d3a09aff9ad6d65418b6d896}




\subsection{Enumeration Type Documentation}
\hypertarget{communication_8h_0bc6723d5d4776ab7cdc646728b775f7}{
\index{communication.h@{communication.h}!TYPE@{TYPE}}
\index{TYPE@{TYPE}!communication.h@{communication.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf TYPE}}}
\label{communication_8h_0bc6723d5d4776ab7cdc646728b775f7}


TYPE permet de différencier les types de modules. Il est utilisé partout dans la librairie de communication. \begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{ack@{ack}!communication.h@{communication.h}}\index{communication.h@{communication.h}!ack@{ack}}\item[{\em 
\hypertarget{communication_8h_0bc6723d5d4776ab7cdc646728b775f7cee8aa0fdd5c1ef3adb3c501fd914bbf}{
ack}
\label{communication_8h_0bc6723d5d4776ab7cdc646728b775f7cee8aa0fdd5c1ef3adb3c501fd914bbf}
}]\index{exec@{exec}!communication.h@{communication.h}}\index{communication.h@{communication.h}!exec@{exec}}\item[{\em 
\hypertarget{communication_8h_0bc6723d5d4776ab7cdc646728b775f74d680ac6b2206c082fa95141c46ec197}{
exec}
\label{communication_8h_0bc6723d5d4776ab7cdc646728b775f74d680ac6b2206c082fa95141c46ec197}
}]ack: type acquisition \index{term@{term}!communication.h@{communication.h}}\index{communication.h@{communication.h}!term@{term}}\item[{\em 
\hypertarget{communication_8h_0bc6723d5d4776ab7cdc646728b775f71338e5a4af684e9170f81e7be5a2732b}{
term}
\label{communication_8h_0bc6723d5d4776ab7cdc646728b775f71338e5a4af684e9170f81e7be5a2732b}
}]exec: type exécution \index{interb@{interb}!communication.h@{communication.h}}\index{communication.h@{communication.h}!interb@{interb}}\item[{\em 
\hypertarget{communication_8h_0bc6723d5d4776ab7cdc646728b775f7d5ed0b0d8d34197735016386859a6ddf}{
interb}
\label{communication_8h_0bc6723d5d4776ab7cdc646728b775f7d5ed0b0d8d34197735016386859a6ddf}
}]term: type terminal (important car très différent des autres) interb: type interboursier \end{description}
\end{Desc}



Definition at line 25 of file communication.h.

\subsection{Function Documentation}
\hypertarget{communication_8h_63a260a1d03237fc4f53b96f3b8586b1}{
\index{communication.h@{communication.h}!init\_\-module@{init\_\-module}}
\index{init\_\-module@{init\_\-module}!communication.h@{communication.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf module}$\ast$ init\_\-module (char $\ast$ {\em nom}, \/  int {\em type}, \/  int {\em bourse})}}
\label{communication_8h_63a260a1d03237fc4f53b96f3b8586b1}


Permet d'initialiser un module \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em nom}]le nom du module \item[{\em type}]le type du module: voir l'enum TYPE \item[{\em bourse}]la bourse dans laquelle est placé le module \end{description}
\end{Desc}


Definition at line 3 of file communication.c.

References module\_\-struct::bourse\_\-id, log\_\-smth(), module\_\-struct::name, module\_\-struct::srv, and module\_\-struct::type.

Referenced by main().\hypertarget{communication_8h_21b24c0798c5ecdfd4cb777e5438a388}{
\index{communication.h@{communication.h}!log\_\-msg\_\-srv@{log\_\-msg\_\-srv}}
\index{log\_\-msg\_\-srv@{log\_\-msg\_\-srv}!communication.h@{communication.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void log\_\-msg\_\-srv (const {\bf server} $\ast$ {\em srv}, \/  {\bf msg} $\ast$ {\em damsg}, \/  char $\ast$ {\em un\_\-msg})}}
\label{communication_8h_21b24c0798c5ecdfd4cb777e5438a388}


Permet de logguer les messages reçus par les serveurs. Placé dans \hyperlink{communication_8h}{communication.h} puisque utilisé uniquement pour la communication par socket. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em srv}]le serveur d'où le log émane \item[{\em damsg}]le message reçu \item[{\em un\_\-msg}]message d'explication lié à l'ordre de transaction \end{description}
\end{Desc}


Definition at line 19 of file communication.c.

References log\_\-msg(), and server\_\-struct::name.

Referenced by launch\_\-acquisition(), launch\_\-execution(), launch\_\-interboursier(), and launch\_\-terminal().\hypertarget{communication_8h_49502824c96a73bc576b4cf9e89dfad8}{
\index{communication.h@{communication.h}!log\_\-srv@{log\_\-srv}}
\index{log\_\-srv@{log\_\-srv}!communication.h@{communication.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void log\_\-srv (const {\bf server} $\ast$ {\em srv}, \/  char $\ast$ {\em un\_\-msg})}}
\label{communication_8h_49502824c96a73bc576b4cf9e89dfad8}


Permet de logguer les communications des serveurs. Placé dans \hyperlink{communication_8h}{communication.h} puisque utilisé uniquement pour la communication par socket. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em srv}]le serveur d'où le log émane \item[{\em un\_\-msg}]message d'explication lié à l'ordre de transaction \end{description}
\end{Desc}


Definition at line 13 of file communication.c.

References comm\_\-type, server\_\-struct::my\_\-port, server\_\-struct::name, and private\_\-write\_\-log().

Referenced by launch\_\-acquisition(), launch\_\-execution(), launch\_\-interboursier(), and launch\_\-terminal().